package com.shen;

import java.io.File;
import java.util.Scanner;

/**
 * Author:shen
 * CreateDate:2020/6/1.
 * Function:
 */
public class demo05 {
    static Scanner scanner=new Scanner(System.in);
    public static void main(String[] args) {
        System.out.println("请输入要剪切的文件名：");
        String fileName=scanner.nextLine();
        System.out.println("请输入目标文件夹地址：");
        String fileDir=scanner.nextLine();
        File file=new File("E:/a/"+fileName);
        if(file.exists()){
            File newFile=new File(fileDir);
            if(newFile.exists()){
                file.renameTo(new File(fileDir+"/"+fileName));
            }else{
                System.out.println("该路径不存在！");
            }

        }else{
            System.out.println("该文件不存在！");
        }
    }
}
